﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Weazel.Math;

using Microsoft.VisualStudio.TestTools.UnitTesting;

#endregion

namespace Weazel.Math.Test
{
  [TestClass]
  public class TestValueCopy
  {
    [TestMethod]
    public void TestValueCopyUnsigned()
    {
      Integer a = new Integer(36, 0x100, false);
      Integer b = new Integer(8, false);

      b.ValueCopy(a);

      Assert.AreEqual("0", b.ToDecimalString());
    }

    [TestMethod]
    public void TestValueCopySigned()
    {
      Integer a = new Integer(36, 0x100, true);
      Integer b = new Integer(8, true);

      b.ValueCopy(a);

      Assert.AreEqual("0", b.ToDecimalString());
    }

    [TestMethod]
    public void TestValueCopySigned_2()
    {
      Integer a = new Integer(8, -100, true);
      Integer b = new Integer(32, true);

      b.ValueCopy(a);

      Assert.AreEqual("-100", b.ToDecimalString());
    }

    [TestMethod]
    public void TestValueCopySigned_3()
    {
      Integer a = new Integer(8, 100, false);
      Integer b = new Integer(96, false);

      b.ValueCopy(a);

      Assert.AreEqual("100", b.ToDecimalString());
    }

    [TestMethod]
    public void TestValueCopySignedUnsigned()
    {
      Integer i = new Integer(8, true);
      Integer j = new Integer(8, "0xff", false);

      i.ValueCopy(j);

      Assert.AreEqual("-1", i.ToDecimalString());
    }
  }
}
